package org.finesys.system.convert;

import org.finesys.system.api.entity.SysPost;
import org.finesys.system.api.vo.PostExcelVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 角色转换
 */
@Mapper
public interface SysPostConvert {

    SysPostConvert INSTANCE = Mappers.getMapper(SysPostConvert.class);

    /**
     * 转换 SysRole 为 RoleExcelVO 对象
     */
    @Mappings({
            @Mapping(target = "lineNum", ignore = true)
    })
    PostExcelVO convert(SysPost sysPost);

    /**
     * 转换 roleExcelVO 为 SysRole 对象
     */
    @Mappings({
            @Mapping(target = "createBy", ignore = true),
            @Mapping(target = "updateBy", ignore = true),
            @Mapping(target = "updateTime", ignore = true),
            @Mapping(target = "params", ignore = true),
            @Mapping(target = "delFlag", ignore = true)
    })
    SysPost convert(PostExcelVO postExcelVO);

    /**
     * 数组转换
     */
    List<PostExcelVO> convertList(List<SysPost> list);
}
